package LeetCode;

/**
 * @author VX5
 * @Title: MJC
 * @ProjectName interview
 * @Description: TODO
 * @date ${DAT}18:18
 */
public class LeetCode376 {
    public int wiggleMaxLength(int[] nums) {
        if (nums.length == 0){
            return 0;
        }
        int up = 1;
        int down = 1;
        for (int i = 1; i < nums.length; i++){
            if (nums[i - 1] < nums[i]){
                up = down + 1;
            } else if (nums[i - 1] > nums[i]) {
                down = up + 1;
            }
        }
        return Math.max(up,down);
    }
}
